using UnityEngine;


namespace Game
{
    public abstract class BaseFakeScene : MonoBehaviour
    {
        [SerializeField]
        private LayerMask m_LayerMask;
        [SerializeField]
        private Material m_SkyBoxMaterial;

        private LayerMask m_PreLayerMask;
        private Material m_PreSkyBoxMaterial;

        protected virtual void Awake()
        {
            if (!GameRoot.HaveInstance()) return;
            GameEntry.Scene.Scene.gameObject.SetActive(false);
            this.m_PreLayerMask = GameRoot.Instance.MainCamera.cullingMask;
            this.m_PreSkyBoxMaterial = RenderSettings.skybox;
            GameRoot.Instance.MainCamera.cullingMask = this.m_LayerMask;
            RenderSettings.skybox = this.m_SkyBoxMaterial;
        }

        protected virtual void OnDestroy()
        {
            if (!GameRoot.HaveInstance()) return;
            GameEntry.Scene.Scene.gameObject.SetActive(true);
            GameRoot.Instance.MainCamera.cullingMask = this.m_PreLayerMask;
            RenderSettings.skybox = this.m_PreSkyBoxMaterial;
        }
    }
}